<?php
	// Database connection and user class must be required first
	require_once( 'db_connect.php' );		// Database connection
	require_once( 'classes.users.php' );	// UserManager and User class definitions

	// Create our user manager object
	$user_manager = new UserManager();

	// Fetch all users
	$user_list = $user_manager->getUsers();

	// Fetch the current user if an ID is present in the query string
	$current_user = null;

	// Always check for existance of $_GET variable prior to accessing it
	if( isset( $_GET['id'] ) ) {

		// Sanitization
		$id = intval( $_GET['id']);

		// Get the user
		$current_user = $user_manager->getUser( $id );

	}

	// Render HTML output
	include 'user_list.php';

?>